﻿<?php
	include("seguranca.php"); // Inclui o arquivo com o sistema de segurança
	protegePagina(); // Chama a função que protege a página
	if ($_SESSION['nivel'] != 'administrador') { //Se não for ADM desloga o usuário e expulsa da página
		expulsaVisitante();
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Criar Pergunta</title>
        <link rel="stylesheet" href="css/bootstrap.css" />
        <link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
        <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
        <link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" />
        <script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
        <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    </head>
    
 	<? 
	if(isset($_GET['action']) && $_GET['action'] == 'cadastrar'){
		$id = $_GET['id'];
		$_SESSION['tema'] = $id;
	}
	?>  
    
<div class="container">

        <header class="masthead">
            <h1 class="muted" align="center">Criar Pergunta</h1>
            <body>
                <form id="form1" name="form1" method="post" action="salvaPergunta.php">
                
                <span id="sprytextarea7">
                    <label for="titulo">Título:</label>
                    <textarea name="titulo" id="titulo" cols="45" rows="5"></textarea>
                    <span id="countsprytextarea7">&nbsp;</span>
                    <span class="textareaRequiredMsg">Informe o título.</span>
                    <span class="textareaMaxCharsMsg">Número máximo de caracteres excedido.</span>
                </span><p/>
                                
                <span id="sprytextarea1">
                	<label for="pergunta">Pergunta:</label>
                        <textarea name="pergunta" id="pergunta" cols="45" rows="5"></textarea>
						<span class="textareaRequiredMsg">Uma pergunta é necessária.</span>
                    </span><p/>

                    <span id="sprytextarea2">
                        <label for="alternativaA">Alternativa A:</label>
                        <textarea name="alternativaA" id="alternativaA" cols="45" rows="5"></textarea>
						<span class="textareaRequiredMsg">Preencha a alternativa.</span>
                    </span><p/>

                    <span id="sprytextarea3">
                        <label for="alternativab">Alternativa B:</label>
                        <textarea name="alternativaB" id="alternativaB" cols="45" rows="5"></textarea>
						<span class="textareaRequiredMsg">Preencha a alternativa.</span> 
                    </span><p/>

                    <span id="sprytextarea4">
                        <label for="alternativaC">Alternativa C:</label>
                        <textarea name="alternativaC" id="alternativaC" cols="45" rows="5"></textarea>
						<span class="textareaRequiredMsg">Preencha a alternativa.</span>
                    </span><p/>

                    <span id="sprytextarea5">
                        <label for="alternativaD">Alternativa D:</label>
                        <textarea name="alternativaD" id="alternativaD" cols="45" rows="5"></textarea>
						<span class="textareaRequiredMsg">Preencha a alternativa.</span>
                    </span><p/>

                    <span id="sprytextarea6">
                        <label for="alternativaE">Alternativa E:</label>
                        <textarea name="alternativaE" id="alternativaE" cols="45" rows="5"></textarea>
						<span class="textareaRequiredMsg">Preencha a alternativa.</span>
                    </span><p/>

                    <span id="sprytextfield1">
                        <label for="resposta">Alternativa Correta:</label>
                        <input type="text" name="resposta" id="resposta" />
                        <span class="textfieldRequiredMsg">Uma resposta é necessária.</span>
                        <span class="textfieldMaxCharsMsg">Número máximo de caracteres excedido.</span>
                    </span><p/>
                    
                  <span id="sprytextfield2">
                    <label for="tipo">Privada:</label>
                    <input type="text" name="tipo" id="tipo" />
                    <span class="textfieldRequiredMsg">Um valor é necessário.</span>
                 </span><p/>
                    	
                 <p><input type="submit" name="enviar" class="btn btn-primary" value="Enviar"></p>
                 
            </form>
                <script type="text/javascript">
					var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1");
                    var sprytextarea2 = new Spry.Widget.ValidationTextarea("sprytextarea2");
                    var sprytextarea3 = new Spry.Widget.ValidationTextarea("sprytextarea3");
                    var sprytextarea4 = new Spry.Widget.ValidationTextarea("sprytextarea4");
                    var sprytextarea5 = new Spry.Widget.ValidationTextarea("sprytextarea5");
                    var sprytextarea6 = new Spry.Widget.ValidationTextarea("sprytextarea6");
                    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {maxChars: 1, hint: "(A,B,C,D,E)"});
					var sprytextarea7 = new Spry.Widget.ValidationTextarea("sprytextarea7", {maxChars:250, counterId:"countsprytextarea7", counterType:"chars_remaining"});
					var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {maxChars: 1, hint: "0 = nao, 1 = sim"});
                </script>
            </body>
            </html>